* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    height: 100vh;
    overflow: auto;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    color: white;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
}

.video-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.local-video-container,
.remote-video-container,
.chat-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.remote-video-container {
    position: relative;
}

.play-prompt {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 1000;
}

#manualPlayBtn {
    margin-top: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

#manualPlayBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#manualPlayBtn:hover::before {
    left: 100%;
}

#manualPlayBtn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

#manualPlayBtn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.local-video-container h2,
.remote-video-container h2,
.chat-container h3 {
    margin-bottom: 15px;
    color: #4a5568;
    text-align: center;
}

video {
    width: 100%;
    flex: 1;
    min-height: 250px;
    max-height: 350px;
    background: #f7fafc;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    object-fit: cover;
}

.controls,
.viewer-controls {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

#startBtn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

#startBtn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

#startBtn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

#stopBtn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

#stopBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

#stopBtn:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

#cameraToggle {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

#cameraToggle:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

#cameraToggle:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

#joinBtn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

#joinBtn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

#joinBtn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

#leaveBtn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

#leaveBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

#leaveBtn:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

button:disabled {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0.6;
}

button:disabled::before {
    display: none;
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

button:focus:not(:focus-visible) {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 按钮加载状态 */
button.loading {
    position: relative;
    color: transparent;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: button-loading-spinner 1s linear infinite;
    color: white;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 按钮成功状态 */
button.success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    transform: scale(0.98);
    transition: all 0.2s ease;
}

button.success::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.status {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
}

#status {
    padding: 5px 15px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #64748b;
}

#status.connected {
    background: #dcfce7;
    color: #16a34a;
}

#status.streaming {
    background: #fef2f2;
    color: #dc2626;
}

/* 直播间信息显示 */
.stream-info {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.stream-info h3 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

.stream-id-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stream-id-container label {
    font-weight: bold;
    color: #495057;
}

.stream-id-container span {
    background-color: #e9ecef;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: monospace;
    color: #495057;
    border: 1px solid #ced4da;
    flex: 1;
}

#copyStreamId {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
    text-transform: none;
}

#copyStreamId::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#copyStreamId:hover::before {
    left: 100%;
}

#copyStreamId:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

#copyStreamId:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

input[type="text"] {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 14px;
    flex: 1;
    min-width: 150px;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-section {
    display: none;
}

.chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    overflow-y: auto;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    background: #f8fafc;
    max-height: 400px;
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 15px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message .username {
    font-weight: bold;
    color: #667eea;
    margin-right: 8px;
}

.message .time {
    font-size: 12px;
    color: #9ca3af;
    float: right;
}

.message.own-message {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    margin-left: 20px;
}

.message.own-message .username {
    color: #e2e8f0;
}

.message.system-message {
    background: #f3f4f6;
    border: none;
    text-align: center;
    font-style: italic;
    color: #6b7280;
}

.chat-input {
    display: flex;
    gap: 10px;
}

#sendBtn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    border: none;
    font-weight: 600;
}

#sendBtn:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#sendBtn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .video-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls,
    .viewer-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .chat-input {
        flex-direction: column;
        gap: 12px;
    }
    
    button {
        padding: 14px 20px;
        font-size: 15px;
        border-radius: 10px;
        margin-bottom: 0;
        min-height: 48px;
    }
    
    #copyStreamId {
        padding: 10px 14px;
        min-height: 40px;
    }
    
    input[type="text"] {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
        min-height: 48px;
    }
} 